﻿// Primitives:number,string,boolean
// More complex types:arrays objects
// Function types,parameters

// Primitives
let age:number;

age = 24;

let userName:string;
userName = 'Max';

let sex:boolean;
sex = false;



// Type inference
let course:string | number  = 'React - The Complete Guide';

course= 123;


// Functions && types
function add(a:number,b:number){
    return a + b;
}


// Generics
function insertAtBeginning<T>(array:T[],value:T){
    const newArray = [value,...array];
    return newArray;
}

const demoArray = [1,2,3];
const updatedArray = insertAtBeginning(demoArray,-1);

const stringArray = insertAtBeginning(['a','b','c'],'d');





